﻿<UserControl x:Class="LevelEditor.View.UserControls.GameSpriteEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mdlEnum="clr-namespace:LevelEditor.Model.Enum"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="300">
    <UserControl.Resources>
        <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="BehaviourTypeEnumValues">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="mdlEnum:AnimationEnum"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </UserControl.Resources>
    <DockPanel LastChildFill="True">
        <GroupBox DockPanel.Dock="Top" Header="Properties">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="75"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>

                <Label Grid.Column="0" Grid.Row="0">Name:</Label>
                <TextBox Grid.Column="1" Grid.Row="0" Name="name" Margin="1"></TextBox>

                <Label Grid.Column="0" Grid.Row="1">Category:</Label>
                <TextBox Grid.Column="1" Grid.Row="1" Name="category" Margin="1"></TextBox>

                <Label Grid.Column="0" Grid.Row="2">Filename:</Label>
                <DockPanel Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch" LastChildFill="True">
                    <Button DockPanel.Dock="Right" Name="fileBrowseBtn" Margin="1" Width="25">...</Button>
                    <TextBox DockPanel.Dock="Left"  Name="filename" Margin="1" IsEnabled="False"></TextBox>
                </DockPanel>
                
                <Label Grid.Column="0" Grid.Row="3">Type:</Label>
                <ComboBox Grid.Column="1" Grid.Row="3" Name="spriteType" Margin="1">
                    <ComboBoxItem DataContext="0">REGULAR_SPRITE</ComboBoxItem>
                    <ComboBoxItem DataContext="1">ANIMATED_SPRITE</ComboBoxItem>
                    <ComboBoxItem DataContext="2">ACTOR_SPRITE</ComboBoxItem>
                    <ComboBoxItem DataContext="3">INTERACTIVE_SPRITE</ComboBoxItem>
                </ComboBox>

            </Grid>
        </GroupBox>
        <GroupBox Name="Rules" DockPanel.Dock="Top" Header="Rules">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="75"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>

                <Label Grid.Column="0" Grid.Row="0">Team:</Label>
                <TextBox Grid.Column="1" Grid.Row="0" Name="team" Margin="1"></TextBox>

                <Label Grid.Column="0" Grid.Row="1">Selectable:</Label>
                <CheckBox Grid.Column="1" Grid.Row="1" Name="isSelectable" Margin="1" IsChecked="True"></CheckBox>
                
                <Label Grid.Column="0" Grid.Row="2">Movable:</Label>
                <CheckBox Grid.Column="1" Grid.Row="2" Name="isMovable" Margin="1" IsChecked="True"></CheckBox>

            </Grid>
        </GroupBox>
        <GroupBox Name="Behaviours" Header="Behaviours" VerticalAlignment="Stretch">
            <DockPanel VerticalAlignment="Stretch" LastChildFill="True">
                <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button Margin="5,5,5,5" Width="75" IsEnabled="False">Delete</Button>
                    <Button Margin="0,5,5,5" Width="125" IsEnabled="False">Add Behaviour</Button>
                </StackPanel>
                <DataGrid Name="behavioursDG" VerticalAlignment="Stretch" AutoGenerateColumns="False" GridLinesVisibility="None" CanUserAddRows="False" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserSortColumns="True" ItemsSource="{Binding }">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Name" Width="*" MinWidth="100" Binding="{ Binding Name }"></DataGridTextColumn>
                        <DataGridComboBoxColumn Header="Behaviour Type" Width="125" ItemsSource="{Binding Source={StaticResource BehaviourTypeEnumValues}}" SelectedValueBinding="{Binding BehaviourType}"></DataGridComboBoxColumn>
                        <DataGridTextColumn Header="Frame Rate" Width="75"  Binding="{ Binding FrameRate }"></DataGridTextColumn>
                        <DataGridComboBoxColumn x:Name="spriteSheetsCB" Header="Sprite Sheet" Width="75" SelectedValueBinding="{Binding SpriteSheetID, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="SpriteSheetID" DisplayMemberPath="Name">
                        </DataGridComboBoxColumn>
                        <DataGridTextColumn Header="Start Index" Width="75" Binding="{ Binding StartIndex }"></DataGridTextColumn>
                        <DataGridTextColumn Header="End Index" Width="75" Binding="{ Binding EndIndex }"></DataGridTextColumn>
                        <DataGridCheckBoxColumn Header="Loop" Width="50" Binding="{ Binding LoopAnimation }"></DataGridCheckBoxColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </DockPanel>
        </GroupBox>
    </DockPanel>
</UserControl>
